#!/bin/sh

# for packages with same dependencies, force the update instead of generating link
# due to schedule stage will auto detect symbolic link, so no need generate new link
check_shared_package()
{
	local bm_name="$1"

	local depends_link=$(get_dependency_file "$bm_name")

	# check both the depends file and the pkg dir
	local target
	if [[ -L "$depends_link" ]]; then
		# $LKP_SRC/distro/depends/${pkg}
		# $LKP_SRC/programs/${pkg}/pkg/{depends|depends-dev}
		target=$(readlink $depends_link)
		target=${target%/pkg/depends*}
		target=$(basename $target)
	elif [[ -L "$(dirname $depends_link)" ]]; then
		# $LKP_SRC/programs/${pkg}/pkg
		target=$(readlink $(dirname $depends_link))
		target=$(basename $(dirname $target))
	else
		return 1
	fi

	BM_NAME="$target"
}

show_deps_list()
{
	local denylist="^pack-deps$
-dev$
-allowlist$"

	find $LKP_SRC/distro/depends/ -type f | sed 's:.*/::' | grep -v "$denylist"
	find $LKP_SRC/programs/ -mindepth 1 -maxdepth 1 -type d -printf "%f\n"
}

show_pack_list()
{
	local tmp_input="$(mktemp /tmp/lkp-tmpinput-XXXXXXXXX)"
	for i in monitors setup tests daemon
	do
		find $LKP_SRC/$i -type f -or -type l | sed 's:.*/::' >> $tmp_input
	done
	find  $LKP_SRC/pack -type f | sed 's:.*/::' |
	grep -x -F -f $tmp_input |
	grep -v -e '^0day-'
	rm $tmp_input &>/dev/null
}

install_runtime_depends()
{
	:
}

update()
{
	:
}

fixup_distro_mirror()
{
	:
}

fixup_preinstall()
{
	:
}

fixup_arch_install()
{
	:
}

pack_benchmark_deps()
{
	:
}

add_i386_package()
{
	:
}
